
package com.zsrt.jmj.computer.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zsrt.jmj.computer.entity.ComputerEntity;
import com.zsrt.jmj.computer.service.ComputerService;

@Controller
@RequestMapping("/computer")
public class ComputerController {

	@Autowired
	private ComputerService service;
	
	@ResponseBody
	@RequestMapping("/add")
	public Map<String, Object> add(ComputerEntity entity) {
		
		Map<String, Object> map = new HashMap<>();
		service.add(entity, map );
		return map;
	}
	@ResponseBody
	@RequestMapping("/findAllComputers")
	public Map<String, Object> findAllComputers() {
		
		Map<String, Object> map = new HashMap<>();
		service.findAllComputers(map);
		return map;
	}
	@ResponseBody
	@RequestMapping("/updateById")
	public Map<String, Object> updateById(ComputerEntity entity) {
		
		Map<String, Object> map = new HashMap<>();
		service.updateById(entity,map);
		return map;
	}
	@ResponseBody
	@RequestMapping("/findComputerById")
	public Map<String, Object> findComputerById(int id) {
		
		Map<String, Object> map = new HashMap<>();
		service.findComputerById(id,map);
		return map;
	}
	@ResponseBody
	@RequestMapping("/deleteByIds")
	public Map<String, Object> deleteByIds(String ids) {
		
		Map<String, Object> map = new HashMap<>();
		service.deleteByIds(ids,map);
		return map;
	}
}
